package com.lx.netty.sixth;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class TestServerHandler extends SimpleChannelInboundHandler<MyDataInfo.MyMessage> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, MyDataInfo.MyMessage msg) throws Exception {
        MyDataInfo.MyMessage.DataType dataType = msg.getDataType();

        if(dataType == MyDataInfo.MyMessage.DataType.PersonType){

            System.out.println(msg.getPerson().getName());
        }else if(dataType == MyDataInfo.MyMessage.DataType.DoyType){
            System.out.println(msg.getDog().getName());
        }else if(dataType == MyDataInfo.MyMessage.DataType.CatType){
            System.out.println(msg.getCat().getName());
        }

    }
}
